<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //原数组变

        //reverse()将数组全置反,将会改变这个数组
        var arr=['a','b','c','d','e'];
        arr.reverse();
        console.log(arr)//['e','d','c','b','a']

        //只有数组能调用reverse()方法
        //字符串想要反过来可以先转成数组，再逆序
        var str1='ABCDE';console.log(str1);//'ABCDE'
        str1_arr=str1.split('');console.log(str1_arr);//['A','B','C','D','E']
        str1_arr.reverse();console.log(str1_arr);//['E','D','C','B','A']
        var str2=str1_arr.join('');console.log(str2)//EDCBA

    </script>
</body>
</html>